﻿#include "qmlengine.h"

QmlEngine::QmlEngine(QObject *parent)
    : QQmlApplicationEngine(parent)
{

    // 初始化 料高选择数据库
    init_LG_DataBase();

    // 初始化 排料加工数据库
    init_PL_DataBase();

    // 初始化 二维码料单数据库
    init_QR_DataBase();

    // 调用注册类
    registerType();

}

void QmlEngine::registerType()
{
    // 注册 QML Engine 类到上下文中
    this->rootContext()->setContextProperty("Cpp_Qmlengine",this);

    // 将CppTranslation 注册到上下文中
    this->rootContext()->setContextProperty("Cpp_translator",CppTranslation::getInstance(this));

    // 注册 Cpp Connect类 到QML
    this->rootContext()->setContextProperty("Cpp_Connect",m_Connect);

    // 注册 Cpp NetWorkProcess类 到QML
    this->rootContext()->setContextProperty("Cpp_NetWork",m_NetWork_Process);

    // 注册 Cpp LG_ChooseDataManager 类 到QML
    this->rootContext()->setContextProperty("Cpp_LGChoose",m_LG_Manager);

    // 注册 Cpp PL_ProcessDataManager 类 到QML
    this->rootContext()->setContextProperty("Cpp_PLProcess",m_PL_Process);

    // 注册 Cpp QR_ProcessDataManager 类 到QML
    this->rootContext()->setContextProperty("Cpp_QRProcess",m_QR_Process);

}

void QmlEngine::init_LG_DataBase()
{
    m_LG_Manager->isExistTable();
}

void QmlEngine::init_PL_DataBase()
{
    m_PL_Process->isExistTable();
}

void QmlEngine::init_QR_DataBase()
{
    m_QR_Process->isExistTable();
}


